/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package application;

import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextField;

/**
 *
 * @author mazid
 */
public class CoreView extends JFrame{
    private JMenuBar bar;
    private JTabbedPane tabedTable, tabedGraphe;
    private JLabel label ;
    private JButton fonction, valider;
    private static JTextField editor;
    private JPanel panel;
    
   // private JButton actualiser = new JButton(new ImageIcon("/home/mazid/NetBeansProjects/trunk/Menu/image/actualiser.jpg"));
    public CoreView(){
        super(); 
        
        bar = new JMenuBar();
        setJMenuBar(bar);
        tabedGraphe = new JTabbedPane();
        tabedTable = new JTabbedPane();
        getContentPane().add(tabedTable);
        getContentPane().add(tabedGraphe, "East");
        tabedGraphe.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        tabedTable.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        setSize(950, 550);
        setTitle("Application Java Excel");
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        setLocationRelativeTo(null);// on centre la fenetre sur l'ecran
        setResizable(true);
       
    }
    
   // cette fonction ajoute la table dans le tabedpane
    public void addTable(JTable table){
        tabedTable.addTab("Feuille "+(tabedTable.getTabCount()+1), new JScrollPane(table));
    }

    public void addPanelHaut(JPanel panel){
        //panel.setLayout(new GridLayout(1,2));
        getContentPane().add(panel,"North");
    }
 
    // ajoute le tabedGraphe
    public void addGraphe(JComponent comp){
        tabedGraphe.addTab("Graphe "+(tabedGraphe.getTabCount()+1),comp);
        
    }
    //fonction pour mettre la valeur de somme dans la barre de formule
    
    // fonction qui return la table en cours dans le tabedpane
    public JTable getJTable(){
        JScrollPane scroll = (JScrollPane)tabedTable.getSelectedComponent();
        return (JTable)scroll.getViewport().getView();
    }

    public JTabbedPane getTabedTable() {
        return tabedTable;
    }

    public JTabbedPane getTabedGraphe() {
        return tabedGraphe;
    }
    
}
